﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Fluid.SiteReader.Client.Extensions
{
    static class IEnumerableExtensions
    {

        public static void ForEachLazy<T>(this IEnumerable<T> enumerator, Action<T> action)
        {
            if (enumerator != null)
                foreach (T item in enumerator)
                    action(item);
        }

        public static void ForEachLazySafe<T>(this IEnumerable<T> enumerator, Action<T> action)
        {
            if (enumerator != null)
                foreach (T item in enumerator)
                {
                    try { action(item); }
                    catch { }
                }
        }

    }
}
